import React from 'react';

import BaseAction from '../common/BaseAction';
import Constants from '../../common/Constants';

export default class ActivityRequestEntryRule extends BaseAction{
  constructor() {
      super();

      this.moduleType = Constants.MODULE_TYPE.ACTIVITY;
      this.name = "ActivityRequestEntryRule";
  }

  call(caller, data) {
      this._baseCall(caller, data);
  }

  //updateData{tag, 状态:0初始化,1请求中,2成功,3失败, 数据}
  finish(data, isSucceed) {
    if (isSucceed) {
      var list = [];
      for (var i = 0; i < data.apply_teams.length; i++) {
        const item = data.apply_teams[i];
        list.push({content_type:1,fid:2,field_id:i,name:item.name,param:'',require:0,sort:1,type:2})
      }
      this.caller.setState({team_arr: [
          {content_type:1,fid:0,field_id:'1team',fields:list,name:'参赛队',param:'',require:1,sort:1,type:2}
        ]})
    }else{
      this.caller.setState({team_arr: []})
      }
    }
}

